#ifndef __REBOOT_SERVER_H__
#define __REBOOT_SERVER_H__

#include <map>
#include <mutex>
#include <functional>
#include "Util/util.h"
#include "jsoncpp/json.h"
#include "Network/Buffer.h"

class RebootServer //: public Fdt::make_shared_base<Config>
{
public:
	using ConfigFunc = std::function<bool(Json::Value &, int &result)>;
	static RebootServer *instance()
	{
		if(s_RebootServer == nullptr)
		{
			s_RebootServer = new RebootServer();
		}
		return s_RebootServer;
	}

	~RebootServer(){}
	void RegistRPC();
	bool Reboot(const Json::Value &request, const Fdt::BufferMap::Ptr &inMap, Json::Value &response, Fdt::BufferMap::Ptr &outMap);

	bool ShutDown(const Json::Value &request, const Fdt::BufferMap::Ptr &inMap, Json::Value &response, Fdt::BufferMap::Ptr &outMap);

protected:
	RebootServer();
private:
	static RebootServer *			s_RebootServer;
	std::recursive_mutex			_mutex;

	std::map<std::string, std::map<void *, ConfigFunc>> _setMap;
	std::map<std::string, std::map<void *, ConfigFunc>> _verifyMap;

};



#endif

